﻿Imports Equipment.DataAccess

Public Class WorkOrderStatus
#Region "Properties"
    Private _type As WorkOrderStatusType
    Public Property ID As WorkOrderStatusType
        Get
            Return _type
        End Get
        Set(ByVal value As WorkOrderStatusType)
            _type = value
        End Set
    End Property

    Private _desc As String
    Public Property Description As String
        Get
            Return _desc
        End Get
        Set(ByVal value As String)
            _desc = value
        End Set
    End Property
#End Region

#Region "Public Section"
    Public Shared Function RetrieveAll() As List(Of WorkOrderStatus)
        Dim result As New List(Of WorkOrderStatus)

        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.AutoCreated, .Description = "Auto Created"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.AwaitingPost, .Description = "Awaiting Post"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.Complete, .Description = "Complete"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.ManuallyCreated, .Description = "Manually Created"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.ReadyForReview, .Description = "Ready for Review"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.ReadyForReviewWithExceptions, .Description = "Ready for Review with Exceptions"})

        Return result
    End Function

    Public Shared Function RetrieveFilterAll() As List(Of WorkOrderStatus)
        Dim result As New List(Of WorkOrderStatus)

        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.AutoCreated, .Description = "Auto Created"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.AwaitingPost, .Description = "Awaiting Post"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.Complete, .Description = "Complete"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.ManuallyCreated, .Description = "Manually Created"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.ReadyForReview, .Description = "Ready for Review"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.ReadyForReviewWithExceptions, .Description = "Ready for Review with Exceptions"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.Open, .Description = "Open"})

        Return result
    End Function

    Public Shared Function RetrieveAllReview() As List(Of WorkOrderStatus)
        Dim result As New List(Of WorkOrderStatus)

        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.ReadyForReview, .Description = "Ready for Review"})
        result.Add(New WorkOrderStatus With {.ID = WorkOrderStatusType.ReadyForReviewWithExceptions, .Description = "Ready for Review with Exceptions"})

        Return result
    End Function

    Public Shared Function GetDescriptionByType(ByVal type As WorkOrderStatusType) As String
        Dim first = RetrieveAll().SingleOrDefault(Function(t) t.ID = type)
        Return first.Description
    End Function
#End Region

End Class
